import request from '@/utils/request'

// 获取专栏列表
export const getColumnList = ({ currentPage, pageSize }) => {
  return request({
    url: 'list/columns',
    method: 'get',
    params: {
      currentPage,
      pageSize
    }
  })
}

// 获取专栏详情
export const getColumnDetail = (columnId) => {
  return request({
    url: `columns/${columnId}`,
    method: 'get'
  })
}

// 获取用户所拥有的专栏
export const getUserColumn = (userId) => {
  return request({
    url: `column/${userId}`,
    method: 'get'
  })
}

// 获取所有专栏
export const getAllColumns = () => {
  return request({
    url: 'list/allColumns',
    method: 'get'
  })
}

// 添加专栏
export const addColumn = ({ userId, title, description, cover }) => {
  return request({
    url: 'columns',
    method: 'post',
    data: {
      userId, title, description, cover
    }
  })
}
